home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / AppleScript / Development Tools / Interfaces / AppleScript 1.1 Interfaces / PInterfaces / AppleEvents.p < prev    next >
Encoding:
Text File  |  1994-04-08  |  25.5 KB  |  639 lines  |  [TEXT/MPS ]

  1. {
  2.    Created: Monday, September 16, 1991 at 2:41 PM
  3.    AppleEvents.p
  4.    Pascal Interface to the Macintosh Libraries
  5.  
  6.    Copyright Apple Computer, Inc. 1989-1992
  7.    All rights reserved
  8.  
  9.    Modified for AppleEvents manager version 1.0.1 July 31st, 1992
  10. }
  11.  
  12.  
  13. {$IFC UNDEFINED UsingIncludes}
  14. {$SETC UsingIncludes := 0}
  15. {$ENDC}
  16.  
  17. {$IFC NOT UsingIncludes}
  18.  UNIT AppleEvents;
  19.  INTERFACE
  20. {$ENDC}
  21.  
  22. {$IFC UNDEFINED UsingAppleEvents}
  23. {$SETC UsingAppleEvents := 1}
  24.  
  25. {$I+}
  26. {$SETC AppleEventsIncludes := UsingIncludes}
  27. {$SETC UsingIncludes := 1}
  28. {$IFC UNDEFINED UsingTypes}
  29. {$I $$Shell(PInterfaces)Types.p}
  30. {$ENDC}
  31. {$IFC UNDEFINED UsingMemory}
  32. {$I $$Shell(PInterfaces)Memory.p}
  33. {$ENDC}
  34. {$IFC UNDEFINED UsingOSUtils}
  35. {$I $$Shell(PInterfaces)OSUtils.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED UsingEvents}
  38. {$I $$Shell(PInterfaces)Events.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED UsingEPPC}
  41. {$I $$Shell(PInterfaces)EPPC.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED UsingNotification}
  44. {$I $$Shell(PInterfaces)Notification.p}
  45. {$ENDC}
  46. {$SETC UsingIncludes := AppleEventsIncludes}
  47.  
  48. (*--------------------------------------------------------------
  49.         Apple event descriptor types
  50. --------------------------------------------------------------*)
  51.  
  52. CONST
  53.  
  54. typeBoolean = 'bool';
  55. typeChar = 'TEXT';
  56. typeSMInt = 'shor';
  57. typeInteger = 'long';
  58. typeSMFloat = 'sing';
  59. typeFloat = 'doub';
  60. typeLongInteger = 'long';
  61. typeShortInteger = 'shor';
  62. typeLongFloat = 'doub';
  63. typeShortFloat = 'sing';
  64. typeExtended = 'exte';
  65. typeComp = 'comp';
  66. typeMagnitude = 'magn';
  67. typeAEList = 'list';
  68. typeAERecord = 'reco';
  69. typeAppleEvent = 'aevt';
  70. typeTrue = 'true';
  71. typeFalse = 'fals';
  72. typeAlias = 'alis';
  73. typeEnumerated = 'enum';
  74. typeType = 'type';
  75. typeAppParameters = 'appa';
  76. typeProperty = 'prop';
  77. typeFSS = 'fss ';
  78. typeKeyword = 'keyw';
  79. typeSectionH = 'sect';
  80. typeWildCard = '****';
  81. typeApplSignature = 'sign';
  82. typeSessionID = 'ssid';
  83. typeTargetID = 'targ';
  84. typeProcessSerialNumber = 'psn ';
  85. typeNull = 'null';                                            { null/nonexistent data }
  86.  
  87.  
  88. (*--------------------------------------------------------------
  89.         Keywords for Apple event parameters
  90. --------------------------------------------------------------*)
  91.  
  92. keyDirectObject = '----';
  93. keyErrorNumber = 'errn';
  94. keyErrorString = 'errs';
  95. keyProcessSerialNumber = 'psn ';
  96.  
  97. (*--------------------------------------------------------------
  98.         Keywords for Apple event attributes
  99. --------------------------------------------------------------*)
  100.  
  101. keyTransactionIDAttr = 'tran';
  102. keyReturnIDAttr = 'rtid';
  103. keyEventClassAttr = 'evcl';
  104. keyEventIDAttr = 'evid';
  105. keyAddressAttr = 'addr';
  106. keyOptionalKeywordAttr = 'optk';
  107. keyTimeoutAttr = 'timo';
  108. keyInteractLevelAttr = 'inte';                                { this attribute is read only - will be set in AESend }
  109. keyEventSourceAttr = 'esrc';                                { this attribute is read only }
  110. keyMissedKeywordAttr = 'miss';                                { this attribute is read only }
  111. keyOriginalAddressAttr = 'from';                            { new in 1.0.1 }
  112.  
  113. (*--------------------------------------------------------------
  114.         Keywords for special handlers
  115. --------------------------------------------------------------*)
  116.  
  117. keyPreDispatch = 'phac';                                    { preHandler accessor Call }
  118. keySelectProc = 'selh';                                        { more selector call }
  119.  
  120. (*--------------------------------------------------------------
  121.         Keyword for recording
  122. --------------------------------------------------------------*)
  123.  
  124. keyAERecorderCount = 'recr';                                { available only in vers 1.0.1 and greater }
  125.  
  126. (*--------------------------------------------------------------
  127.         Keyword for version information
  128. --------------------------------------------------------------*)
  129.  
  130. keyAEVersion = 'vers';                                        { available only in vers 1.0.1 and greater }
  131.  
  132. (*--------------------------------------------------------------
  133.         Event Class
  134. --------------------------------------------------------------*)
  135.  
  136. kCoreEventClass = 'aevt';
  137.  
  138. (*--------------------------------------------------------------
  139.         Event ID's
  140. --------------------------------------------------------------*)
  141.  
  142. kAEOpenApplication = 'oapp';
  143. kAEOpenDocuments = 'odoc';
  144. kAEPrintDocuments = 'pdoc';
  145. kAEQuitApplication = 'quit';
  146. kAEAnswer = 'ansr';
  147. kAEApplicationDied = 'obit';
  148.  
  149. (*--------------------------------------------------------------
  150.         Constants for use in AESend mode
  151. --------------------------------------------------------------*)
  152.  
  153. kAENoReply = $00000001;                                        { sender doesn't want a reply to the event }
  154. kAEQueueReply = $00000002;                                    { sender wants a reply but won't wait }
  155. kAEWaitReply = $00000003;                                    { sender wants a reply and will be waiting }
  156. kAENeverInteract = $00000010;                                { server should not interact with user }
  157. kAECanInteract = $00000020;                                    { server may try to interact with user }
  158. kAEAlwaysInteract = $00000030;                                { server should always interact with user where appropriate }
  159. kAECanSwitchLayer = $00000040;                                { interaction may switch layer }
  160. kAEDontReconnect = $00000080;                                { don't reconnect if there is a sessClosedErr from PPCToolbox }
  161. kAEWantReceipt = nReturnReceipt;                            { send wants a receipt of message }
  162. kAEDontRecord = $00001000;                                    { don't record this event - available only in vers 1.0.1 and greater }
  163. kAEDontExecute = $00002000;                                    { don't send the event for recording - available only in vers 1.0.1 and greater }
  164.  
  165. (*--------------------------------------------------------------
  166.         Constants for the send priority in AESend
  167. --------------------------------------------------------------*)
  168.  
  169. kAENormalPriority = $00000000;                                { post message at the end of the event queue }
  170. kAEHighPriority = nAttnMsg;                                    { post message at the front of the event queue }
  171.  
  172. (*--------------------------------------------------------------
  173.         Constants for recording
  174. --------------------------------------------------------------*)
  175.  
  176. kAEStartRecording = 'reca';                                    { available only in vers 1.0.1 and greater }
  177. kAEStopRecording = 'recc';                                    { available only in vers 1.0.1 and greater }
  178. kAENotifyStartRecording = 'rec1';                            { available only in vers 1.0.1 and greater }
  179. kAENotifyStopRecording = 'rec0';                            { available only in vers 1.0.1 and greater }
  180. kAENotifyRecording = 'recr';                                { available only in vers 1.0.1 and greater }
  181.  
  182. (*--------------------------------------------------------------
  183.         Constant for the returnID param of AECreateAppleEvent
  184. --------------------------------------------------------------*)
  185.  
  186. kAutoGenerateReturnID = -1;                                    { AECreateAppleEvent will generate a session-unique ID }
  187.  
  188. (*--------------------------------------------------------------
  189.         Constant for transaction ID's
  190. --------------------------------------------------------------*)
  191.  
  192. kAnyTransactionID = 0;                                        { no transaction is in use }
  193.  
  194. (*--------------------------------------------------------------
  195.         Constants for timeout durations
  196. --------------------------------------------------------------*)
  197.  
  198. kAEDefaultTimeout = -1;                                        { timeout value determined by AEM }
  199. kNoTimeOut = -2;                                            { wait until reply comes back, however long it takes }
  200.  
  201. (*--------------------------------------------------------------
  202.         Constants for AEResumeTheCurrentEvent
  203. --------------------------------------------------------------*)
  204.  
  205. kAENoDispatch = 0;
  206. kAEUseStandardDispatch = -1;
  207.  
  208.  
  209. (*--------------------------------------------------------------
  210.         Apple event manager error messages
  211. --------------------------------------------------------------*)
  212.  
  213. errAECoercionFail             = -1700;                        { bad parameter data or unable to coerce the data supplied }
  214. errAEDescNotFound             = -1701;
  215. errAECorruptData             = -1702;
  216. errAEWrongDataType             = -1703;
  217. errAENotAEDesc                 = -1704;
  218. errAEBadListItem             = -1705;                        { specified list item does not exist }
  219. errAENewerVersion             = -1706;                        { need newer version of AppleEvent Manager }
  220. errAENotAppleEvent             = -1707;                        { the event is not in AppleEvent format }
  221. errAEEventNotHandled         = -1708;                        { the AppleEvent was not handled by any handler }
  222. errAEReplyNotValid             = -1709;                        { AEResetTimer was passed an invalid reply parameter }
  223. errAEUnknownSendMode         = -1710;                        { mode wasn't NoReply, WaitReply, or QueueReply - or Interaction level is unknown }
  224. errAEWaitCanceled             = -1711;                        { in AESend, user cancelled out of wait loop for reply or receipt }
  225. errAETimeout                 = -1712;                        { the AppleEvent timed out }
  226. errAENoUserInteraction         = -1713;                        { no user interaction is allowed }
  227. errAENotASpecialFunction     = -1714;                        { there is no special function with this keyword }
  228. errAEParamMissed             = -1715;                        { a required parameter was not accessed }
  229. errAEUnknownAddressType     = -1716;                        { the target address type is not known }
  230. errAEHandlerNotFound         = -1717;                        { no handler in the dispatch tables fits the parameters to AEGetEventHandler or AEGetCoercionHandler }
  231. errAEReplyNotArrived         = -1718;                        { the contents of the reply you are accessing have not yet arrived }
  232. errAEIllegalIndex             = -1719;                        { index is out of range in a put operation }
  233. errAEUnknownObjectType        = -1731;                        { available only in version 1.0.1 or greater }
  234. errAERecordingIsAlreadyOn    = -1732;                        { available only in version 1.0.1 or greater }
  235.  
  236.  
  237. (*--------------------------------------------------------------
  238.         Apple event manager data types
  239. --------------------------------------------------------------*)
  240.  
  241. TYPE
  242.  
  243. AEEventClass = PACKED ARRAY [1..4] OF CHAR;
  244. AEEventID = PACKED ARRAY [1..4] OF CHAR;
  245. AEKeyword = PACKED ARRAY [1..4] OF CHAR;
  246.  
  247. DescType = ResType;
  248.  
  249. AEDesc = RECORD
  250.             descriptorType: DescType;
  251.             dataHandle: Handle;
  252.           END;
  253.  
  254. AEKeyDesc = RECORD
  255.                descKey: AEKeyword;
  256.                descContent: AEDesc;
  257.              END;
  258.  
  259. AEAddressDesc = AEDesc;                                        { an AEDesc which contains addressing data }
  260. AEDescList = AEDesc;                                        { a list of AEDesc is a special kind of AEDesc }
  261. AERecord = AEDescList;                                        { AERecord is a list of keyworded AEDesc }
  262. AppleEvent = AERecord;                                        { an AERecord that contains an AppleEvent }
  263. AESendMode = LONGINT;                                        { type of parameter to AESend }
  264. AESendPriority = INTEGER;                                    { type of priority param of AESend }
  265.  
  266. AEInteractAllowed = (kAEInteractWithSelf,kAEInteractWithLocal,
  267.                      kAEInteractWithAll);
  268.  
  269. AEEventSource = (kAEUnknownSource,kAEDirectCall,kAESameProcess,        { return param to AEGetTheCurrentEvent and kAEEventSource attribute }
  270.                  kAELocalProcess,kAERemoteProcess);
  271.  
  272. AEArrayType = (kAEDataArray,kAEPackedArray,kAEHandleArray,kAEDescArray,
  273.                kAEKeyDescArray);
  274.  
  275. AEArrayData = RECORD
  276.                  CASE AEArrayType OF
  277.                     kAEDataArray:
  278.                       (AEDataArray: ARRAY[0..0] OF Integer);
  279.                     kAEPackedArray:
  280.                       (AEPackedArray: PACKED ARRAY[0..0] OF Char);
  281.                     kAEHandleArray:
  282.                       (AEHandleArray: ARRAY[0..0] OF Handle);
  283.                     kAEDescArray:
  284.                       (AEDescArray: ARRAY[0..0] OF AEDesc);
  285.                     kAEKeyDescArray:
  286.                       (AEKeyDescArray: ARRAY[0..0] OF AEKeyDesc);
  287.                  END;
  288.  
  289. AEArrayDataPointer = ^AEArrayData;
  290.  
  291. EventHandlerProcPtr = ProcPtr;
  292. IdleProcPtr = ProcPtr;
  293. EventFilterProcPtr = ProcPtr;
  294.  
  295.  
  296. (**************************************************************************
  297.  The following calls apply to any AEDesc. Every 'result' descriptor is
  298.  created for you, so you will be responsible for memory management
  299.  (including disposing) of the descriptors so created. Note: purgeable
  300.  descriptor data is not supported - the AEM does not call LoadResource.  
  301. **************************************************************************)
  302.  
  303. FUNCTION AECreateDesc(typeCode: DescType; dataPtr: Ptr; dataSize: Size;
  304.                        VAR result: AEDesc): OSErr;
  305.     INLINE $303C, $0825, $A816;
  306.     
  307. FUNCTION AECoercePtr(typeCode: DescType; dataPtr: Ptr; dataSize: Size;
  308.                      toType: DescType; VAR result: AEDesc): OSErr;
  309.     INLINE $303C, $0A02, $A816;
  310.     
  311. FUNCTION AECoerceDesc(theAEDesc: AEDesc; toType: DescType;
  312.                       VAR result: AEDesc): OSErr;
  313.     INLINE $303C, $0603, $A816;
  314.     
  315. FUNCTION AEDisposeDesc(VAR theAEDesc: AEDesc): OSErr;
  316.     INLINE $303C, $0204, $A816;
  317.     
  318. FUNCTION AEDuplicateDesc(theAEDesc: AEDesc; VAR result: AEDesc): OSErr;
  319.     INLINE $303C, $0405, $A816;
  320.  
  321. (**************************************************************************
  322.   The following calls apply to AEDescList. Since AEDescList is a subtype of
  323.   AEDesc, the calls in the previous section can also be used for AEDescList.
  324.   All list and array indices are 1-based. If the data was greater than
  325.   maximumSize in the routines below, then actualSize will be greater than
  326.   maximumSize, but only maximumSize bytes will actually be retrieved.
  327. **************************************************************************)
  328.  
  329. FUNCTION AECreateList(factoringPtr: Ptr; factoredSize: Size;
  330.                       isRecord: BOOLEAN; VAR resultList: AEDescList): OSErr;
  331.     INLINE $303C, $0706, $A816;
  332.  
  333. FUNCTION AECountItems(theAEDescList: AEDescList; VAR theCount: LONGINT): OSErr;
  334.     INLINE $303C, $0407, $A816;
  335.  
  336. FUNCTION AEPutPtr(theAEDescList: AEDescList; index: LONGINT;
  337.                   typeCode: DescType; dataPtr: Ptr; dataSize: Size): OSErr;
  338.     INLINE $303C, $0A08, $A816;
  339.  
  340. FUNCTION AEPutDesc(theAEDescList: AEDescList; index: LONGINT;
  341.                    theAEDesc: AEDesc): OSErr;
  342.     INLINE $303C, $0609, $A816;
  343.     
  344. FUNCTION AEGetNthPtr(theAEDescList: AEDescList; index: LONGINT;
  345.                      desiredType: DescType; VAR theAEKeyword: AEKeyword;
  346.                      VAR typeCode: DescType; dataPtr: Ptr; maximumSize: Size;
  347.                      VAR actualSize: Size): OSErr;
  348.     INLINE $303C, $100A, $A816;
  349.  
  350. FUNCTION AEGetNthDesc(theAEDescList: AEDescList; index: LONGINT;
  351.                       desiredType: DescType; VAR theAEKeyword: AEKeyword;
  352.                       VAR result: AEDesc): OSErr;
  353.     INLINE $303C, $0A0B, $A816;
  354.  
  355. FUNCTION AESizeOfNthItem(theAEDescList: AEDescList; index: LONGINT;
  356.                          VAR typeCode: DescType; VAR dataSize: Size): OSErr;
  357.     INLINE $303C, $082A, $A816;
  358.     
  359. FUNCTION AEGetArray(theAEDescList: AEDescList; arrayType: AEArrayType;
  360.                     arrayPtr: AEArrayDataPointer; maximumSize: Size;
  361.                     VAR itemType: DescType; VAR itemSize: Size;
  362.                     VAR itemCount: LONGINT): OSErr;
  363.     INLINE $303C, $0D0C, $A816;
  364.  
  365. FUNCTION AEPutArray(theAEDescList: AEDescList; arrayType: AEArrayType;
  366.                     arrayPtr: AEArrayDataPointer; itemType: DescType;
  367.                     itemSize: Size; itemCount: LONGINT): OSErr;
  368.     INLINE $303C, $0B0D, $A816;
  369.  
  370. FUNCTION AEDeleteItem(theAEDescList: AEDescList; index: LONGINT): OSErr;
  371.     INLINE $303C, $040E, $A816;
  372.  
  373.  
  374. (**************************************************************************
  375.  The following calls apply to AERecord. Since AERecord is a subtype of
  376.  AEDescList, the calls in the previous sections can also be used for
  377.  AERecord an AERecord can be created by using AECreateList with isRecord
  378.  set to true. 
  379. **************************************************************************)
  380.  
  381. FUNCTION AEPutKeyPtr(theAERecord: AERecord; theAEKeyword: AEKeyword;
  382.                      typeCode: DescType; dataPtr: Ptr; dataSize: Size): OSErr;
  383.     INLINE $303C, $0A0F, $A816;
  384.  
  385. FUNCTION AEPutKeyDesc(theAERecord: AERecord; theAEKeyword: AEKeyword;
  386.                       theAEDesc: AEDesc): OSErr;
  387.     INLINE $303C, $0610, $A816;
  388.  
  389. FUNCTION AEGetKeyPtr(theAERecord: AERecord; theAEKeyword: AEKeyword;
  390.                      desiredType: DescType; VAR typeCode: DescType;
  391.                      dataPtr: Ptr; maximumSize: Size;
  392.                      VAR actualSize: Size): OSErr;
  393.     INLINE $303C, $0E11, $A816;
  394.  
  395. FUNCTION AEGetKeyDesc(theAERecord: AERecord; theAEKeyword: AEKeyword;
  396.                       desiredType: DescType; VAR result: AEDesc): OSErr;
  397.     INLINE $303C, $0812, $A816;
  398.  
  399. FUNCTION AESizeOfKeyDesc(theAERecord: AERecord; theAEKeyword: AEKeyword;
  400.                          VAR typeCode: DescType; VAR dataSize: Size): OSErr;
  401.     INLINE $303C, $0829, $A816;
  402.  
  403. FUNCTION AEDeleteKeyDesc(theAERecord: AERecord; theAEKeyword: AEKeyword): OSErr;
  404.     INLINE $303C, $0413, $A816;
  405.  
  406.  
  407. (**************************************************************************
  408.   The following calls are used to pack and unpack parameters from records
  409.   of type AppleEvent. Since AppleEvent is a subtype of AERecord, the calls
  410.   in the previous sections can also be used for variables of type
  411.   AppleEvent. The next six calls are in fact identical to the six calls
  412.   for AERecord.
  413. **************************************************************************)
  414.  
  415. FUNCTION AEPutParamPtr(theAppleEvent: AppleEvent; theAEKeyword: AEKeyword;
  416.                        typeCode: DescType; dataPtr: Ptr;
  417.                        dataSize: Size): OSErr;
  418.     INLINE $303C,$0A0F,$A816;
  419.  
  420. FUNCTION AEPutParamDesc(theAppleEvent: AppleEvent; theAEKeyword: AEKeyword;
  421.                         theAEDesc: AEDesc): OSErr;
  422.     INLINE $303C,$0610,$A816;
  423.     
  424. FUNCTION AEGetParamPtr(theAppleEvent: AppleEvent; theAEKeyword: AEKeyword;
  425.                        desiredType: DescType; VAR typeCode: DescType;
  426.                        dataPtr: Ptr; maximumSize: Size;
  427.                        VAR actualSize: Size): OSErr;
  428.     INLINE $303C,$0E11,$A816;
  429.     
  430. FUNCTION AEGetParamDesc(theAppleEvent: AppleEvent; theAEKeyword: AEKeyword;
  431.                         desiredType: DescType; VAR result: AEDesc): OSErr;
  432.     INLINE $303C,$0812,$A816;
  433.     
  434. FUNCTION AESizeOfParam(theAppleEvent: AppleEvent; theAEKeyword: AEKeyword;
  435.                        VAR typeCode: DescType; VAR dataSize: Size): OSErr;
  436.     INLINE $303C,$0829,$A816;
  437.     
  438. FUNCTION AEDeleteParam(theAppleEvent: AppleEvent;
  439.                        theAEKeyword: AEKeyword): OSErr;
  440.     INLINE $303C,$0413,$A816;
  441.  
  442. (**************************************************************************
  443.  The following calls also apply to type AppleEvent. Message attributes are
  444.  far more restricted, and can only be accessed through the following 5
  445.  calls. The various list and record routines cannot be used to access the
  446.  attributes of an event. 
  447. **************************************************************************)
  448.  
  449. FUNCTION AEGetAttributePtr(theAppleEvent: AppleEvent;
  450.                            theAEKeyword: AEKeyword; desiredType: DescType;
  451.                            VAR typeCode: DescType; dataPtr: Ptr;
  452.                            maximumSize: Size; VAR actualSize: Size): OSErr;
  453.     INLINE $303C,$0E15,$A816;
  454.     
  455. FUNCTION AEGetAttributeDesc(theAppleEvent: AppleEvent;
  456.                             theAEKeyword: AEKeyword; desiredType: DescType;
  457.                             VAR result: AEDesc): OSErr;
  458.     INLINE $303C,$0826,$A816;
  459.     
  460. FUNCTION AESizeOfAttribute(theAppleEvent: AppleEvent;
  461.                            theAEKeyword: AEKeyword; VAR typeCode: DescType;
  462.                            VAR dataSize: Size): OSErr;
  463.     INLINE $303C,$0828,$A816;
  464.     
  465. FUNCTION AEPutAttributePtr(theAppleEvent: AppleEvent;
  466.                            theAEKeyword: AEKeyword; typeCode: DescType;
  467.                            dataPtr: Ptr; dataSize: Size): OSErr;
  468.     INLINE $303C,$0A16,$A816;
  469.     
  470. FUNCTION AEPutAttributeDesc(theAppleEvent: AppleEvent;
  471.                             theAEKeyword: AEKeyword; theAEDesc: AEDesc): OSErr;
  472.     INLINE $303C,$0627,$A816;
  473.  
  474. (**************************************************************************
  475.   The next couple of calls are basic routines used to create, send,
  476.   and process AppleEvents. 
  477. **************************************************************************)
  478.  
  479. FUNCTION AECreateAppleEvent(theAEEventClass: AEEventClass;
  480.                             theAEEventID: AEEventID; target: AEAddressDesc;
  481.                             returnID: INTEGER; transactionID: LONGINT;
  482.                             VAR result: AppleEvent): OSErr;
  483.     INLINE $303C,$0B14,$A816;
  484.  
  485. FUNCTION AESend(theAppleEvent: AppleEvent; VAR reply: AppleEvent;
  486.                 sendMode: AESendMode; sendPriority: AESendPriority;
  487.                 timeOutInTicks: LONGINT; idleProc: IdleProcPtr;
  488.                 filterProc: EventFilterProcPtr): OSErr;
  489.     INLINE $303C,$0D17,$A816;
  490.  
  491. FUNCTION AEProcessAppleEvent(theEventRecord: EventRecord): OSErr;
  492.     INLINE $303C,$021B,$A816;
  493.  
  494. (* 
  495.  Note: during event processing, an event handler may realize that it is
  496.  likely to exceed the client's timeout limit. Passing the reply to this
  497.  routine causes a wait event to be generated that asks the client
  498.  for more time. 
  499. *)
  500.  
  501. FUNCTION AEResetTimer(reply: AppleEvent): OSErr;
  502.     INLINE $303C,$0219,$A816;
  503.  
  504. (**************************************************************************
  505.  The following four calls are available for applications which need more
  506.  sophisticated control over when and how events are processed. Applications
  507.  which implement multi-session servers or which implement their own
  508.  internal event queueing will probably be the major clients of these
  509.  routines. They can be called from within a handler to prevent the AEM from
  510.  disposing of the AppleEvent when the handler returns. They can be used to
  511.  asynchronously process the event (as MacApp does).
  512. **************************************************************************)
  513.  
  514. FUNCTION AESuspendTheCurrentEvent(theAppleEvent: AppleEvent): OSErr;
  515.     INLINE $303C,$022B,$A816;
  516.  
  517. (* 
  518.  Note: The following routine tells the AppleEvent manager that processing
  519.  is either about to resume or has been completed on a previously suspended
  520.  event. The procPtr passed in as the dispatcher parameter will be called to
  521.  attempt to redispatch the event. Several constants for the dispatcher
  522.  parameter allow special behavior. They are:
  523.       - kAEUseStandardDispatch means redispatch as if the event was just
  524.       received, using the standard AppleEvent dispatch mechanism.
  525.       - kAENoDispatch means ignore the parameter.
  526.          Use this in the case where the event has been handled and no
  527.       redispatch is needed.
  528.       - non nil means call the routine which the dispatcher points to.
  529. *)
  530.  
  531. FUNCTION AEResumeTheCurrentEvent(theAppleEvent: AppleEvent;
  532.                                  reply: AppleEvent;
  533.                                  dispatcher: EventHandlerProcPtr;
  534.                                  handlerRefcon: LONGINT): OSErr;
  535.     INLINE $303C,$0818,$A816;
  536.  
  537. FUNCTION AEGetTheCurrentEvent(VAR theAppleEvent: AppleEvent): OSErr;
  538.     INLINE $303C,$021A,$A816;
  539.  
  540. FUNCTION AESetTheCurrentEvent(theAppleEvent: AppleEvent): OSErr;
  541.     INLINE $303C,$022C,$A816;
  542.  
  543. (**************************************************************************
  544.   The following three calls are used to allow applications to behave
  545.   courteously when a user interaction such as a dialog box is needed. 
  546. **************************************************************************)
  547.  
  548. FUNCTION AEGetInteractionAllowed(VAR level: AEInteractAllowed): OSErr;
  549.     INLINE $303C,$021D,$A816;
  550.  
  551. FUNCTION AESetInteractionAllowed(level: AEInteractAllowed): OSErr;
  552.     INLINE $303C,$011E,$A816;
  553.  
  554. FUNCTION AEInteractWithUser(timeOutInTicks: LONGINT; nmReqPtr: NMRecPtr;
  555.                             idleProc: IdleProcPtr): OSErr;
  556.     INLINE $303C,$061C,$A816;
  557.  
  558. (**************************************************************************
  559.   These calls are used to set up and modify the event dispatch table.
  560. **************************************************************************)
  561.  
  562. FUNCTION AEInstallEventHandler(theAEEventClass: AEEventClass;
  563.                                theAEEventID: AEEventID;
  564.                                handler: EventHandlerProcPtr;
  565.                                handlerRefcon: LONGINT;
  566.                                isSysHandler: BOOLEAN): OSErr;
  567.     INLINE $303C,$091F,$A816;
  568.  
  569. FUNCTION AERemoveEventHandler(theAEEventClass: AEEventClass;
  570.                               theAEEventID: AEEventID;
  571.                               handler: EventHandlerProcPtr;
  572.                               isSysHandler: BOOLEAN): OSErr;
  573.     INLINE $303C,$0720,$A816;
  574.  
  575. FUNCTION AEGetEventHandler(theAEEventClass: AEEventClass;
  576.                            theAEEventID: AEEventID;
  577.                            VAR handler: EventHandlerProcPtr;
  578.                            VAR handlerRefcon: LONGINT;
  579.                            isSysHandler: BOOLEAN): OSErr;
  580.     INLINE $303C,$0921,$A816;
  581.  
  582. (**************************************************************************
  583.   These calls are used to set up and modify the coercion dispatch table.
  584. **************************************************************************)
  585.  
  586. FUNCTION AEInstallCoercionHandler(fromType: DescType; toType: DescType;
  587.                                   handler: ProcPtr; handlerRefcon: LONGINT;
  588.                                   fromTypeIsDesc: BOOLEAN;
  589.                                   isSysHandler: BOOLEAN): OSErr;
  590.     INLINE $303C, $0A22, $A816;
  591.  
  592. FUNCTION AERemoveCoercionHandler(fromType: DescType; toType: DescType;
  593.                                  handler: ProcPtr;
  594.                                  isSysHandler: BOOLEAN): OSErr;
  595.     INLINE $303C, $0723, $A816;
  596.  
  597. FUNCTION AEGetCoercionHandler(fromType: DescType; toType: DescType;
  598.                               VAR handler: ProcPtr;
  599.                               VAR handlerRefcon: LONGINT;
  600.                               VAR fromTypeIsDesc: BOOLEAN;
  601.                               isSysHandler: BOOLEAN): OSErr;
  602.     INLINE $303C, $0B24, $A816;
  603.  
  604. (**************************************************************************
  605.   These calls are used to set up and modify special hooks into the
  606.   AppleEvent manager.
  607. **************************************************************************)
  608.  
  609. FUNCTION AEInstallSpecialHandler(functionClass: AEKeyword; handler: ProcPtr;
  610.                                  isSysHandler: BOOLEAN): OSErr;
  611.     INLINE $303C, $0500, $A816;
  612.  
  613. FUNCTION AERemoveSpecialHandler(functionClass: AEKeyword; handler: ProcPtr;
  614.                                 isSysHandler: BOOLEAN): OSErr;
  615.     INLINE $303C, $0501, $A816;
  616.  
  617. FUNCTION AEGetSpecialHandler(functionClass: AEKeyword; VAR handler: ProcPtr;
  618.                              isSysHandler: BOOLEAN): OSErr;
  619.     INLINE $303C, $052D, $A816;
  620.  
  621.  
  622. (**************************************************************************
  623.   This call was added in version 1.0.1. If called with the keyword
  624.   keyAERecorderCount ('recr'), the number of recorders that are
  625.   currently active is returned in 'result'.
  626. **************************************************************************)
  627.  
  628. { available only in AEM vers 1.0.1 and greater }
  629. { when passed the keyAERecorderCount is returns the number of recorders active }
  630. FUNCTION AEManagerInfo(keyWord: AEKeyWord; VAR result: LongInt): OSErr;
  631.     INLINE $303C, $0441, $A816;
  632.     
  633.     
  634.     
  635. {$ENDC} { UsingAppleEvents }
  636.  
  637. {$IFC NOT UsingIncludes}
  638.  END.
  639. {$ENDC}